home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 April: Mac OS SDK / Dev.CD Apr 98 SDK2.toast / Development Kits (Disc 2) / ScriptX / Documentation / Code Examples from Docs / langguid / chap_06 / xmpl_02.sx < prev    next >
Encoding:
Text File  |  1996-05-21  |  691 b   |  32 lines  |  [TEXT/ttxt]

  1. --<<<
  2. -- Kaleida Labs, Inc.
  3. -- Field Guide to the ScriptX Language
  4. -- chapter 6, example 2
  5.  
  6. --create a module to avoid naming conflicts
  7. module Scratch21 uses ScriptX end
  8. in module Scratch21
  9.  
  10. -- examples for how to create objects
  11.  
  12. -- using new, but with embedded objects
  13. global myShape := new TwoDShape \
  14.     boundary:(object (Rect) x2:30, y2:20 end) \
  15.     stroke:(object (Brush) color:blackColor, pattern:grayPattern \
  16.             settings linewidth:3 end)
  17.  
  18. -- using the object definition expression
  19. object lotsOfVars (Player)
  20.     instance variables
  21.         firstIV
  22.         secondIV:@cowabunga
  23.         thirdIV:object (PushButton) inst vars pb1 end
  24. end
  25.  
  26. object foo (Array)
  27.     instance vars
  28.         a, b
  29.         c:"purple"
  30.         d:3, e:4
  31. end
  32. -->>>